package com.worldcup.model.dto;

import com.worldcup.model.PredictGroup;
import com.worldcup.service.impl.CountryServiceImpl;
import lombok.Getter;
import lombok.Setter;

import java.util.ArrayList;
import java.util.List;

/**
 * @author duwan.zq
 * @date 2018/06/02
 */
@Getter
@Setter
public class PredictTypeGroupDTO {

    private String group;

    private List<PredictGroupDTO> matches;

    public PredictTypeGroupDTO(){
    }

    public PredictTypeGroupDTO(String groupName, List<PredictGroup> predictGroups) {
        this.group = groupName;
        if(predictGroups == null){
            return;
        }
        this.matches = new ArrayList<>(predictGroups.size());
        predictGroups.forEach(predictGroup -> this.matches.add(new PredictGroupDTO(predictGroup,
            CountryServiceImpl.getCountryCache(predictGroup.getCountryId()))));
    }

    @Override
    public String toString(){
        return super.toString();
    }

}
